import { Vector2, _logic, ccclass } from "../../../main/script/Main";
import { EEntityType } from "../../../main/script/module/define/LogicDefine";
import { CubeEntity } from "./CubeEntity";
import { Entity } from "./Entity";
import { ISelectionEntityData } from "./SelectionEntity";

const v2T = new Vector2()



@ccclass("TipEntity")
export class TipEntity extends Entity {

    public entityType = EEntityType.Effect
    public isPut = true
    public isUpdateStateMackine = false
    public isDestroy = false
    public isMoving() { return false }

    public data: ISelectionEntityData = null!

    protected onStateEnterLoad(): void {
        super.onStateEnterLoad()
    }


    protected onStateEnterRun(): void {
        super.onStateEnterRun()
        let drag = this.scene.entityMgr.drag

        let _scale = 1
        if (this.data == drag) {
            v2T.set(drag.itemPos)
            _scale = drag.itemScale()
        } else {
            _scale = _logic.scaleRatio
            let cubeEntity = this.data as CubeEntity
            v2T.set(cubeEntity.data.rect.center)
        }
        this.setScaleNum(_scale * 0.95, false)

        v2T.y += 5
        this.setPositionXY(v2T, false)
    }




}